Form1 Form1 Form1 List1 Command1 Create array Command2 Load list box Command3 Rewrite array Command4 Clear list box Command5 Clear array Command6 Command0 Create a test file on disk C: hread hFile memAddrI dwBytes hwrite lclose llseek: lOffset iOrigin OpenFile lpFileName lpReOpenBuff OFSTRUCT wStyle OF_READ OF_WRITEo OF_CREATEA GlobalAlloc wFlags GlobalFree} hMemW GlobalLock GlobalUnlock MemoryReada dwOffset lpvBuf dwcb$ MemoryWrite Form_Clickp g_FMmain g_frecs f_mHndl CreateHuge; size1 lpAddrM inBytes: lpAddr1( FillAvListBox SendMessage$ ControlhWnd ListAvFonts LB_RESETCONTENTB mnuType mSel\ GlobalHandleToSel rBytes TrueType Delete fntNm fullnameV LB_ADDSTRING LB_SETITEMDATAQ g_FType List1 Command4_Click Command1_Click Command2_Click Command3_Click x127O LenRec frecs Command6_Click Command5_Click Command7_Click Command0_Click LOCATEZ f_Ofl f_FMmainz f_FRecs f_fType f_RecMmain f_Recrecs f_Rec f_RecType f_File f_NbrRecs FillListBox RecLen f_mSel f_LenRec f_RecLen wParam lParam GetFocus WM_USER GMEM_MOVEABLE GMEM_ZEROINIT Form_Load Form2 _hread kernel _lclose Kernel _llseek Kernel Kernel OpenFile() Flags Kernel) KernelA KernelA KernelA Toolhelp.dll: Toolhelp.dll} Toolhelp.dll} Open file structure record Name of file containing sample records Number of records in sample file Memory handle to global memory Sample record Memory selectorc Length of sample recordg CreateHuge --- creates huge array of records from sample file. The records are in a type structure defined as "f_RecType". Sample.dat --- open the data file for reading --- get the size of the file --- determine how many records are in the file --- reset the file pointer to the start of the file --- create the global memory objecte --- make sure enough memory is available Insufficient memory to allocate array" --- get the address of the memory object --- read the data file into the memory objecte --- close the file --- unlock the memory object Command1_Click Command2_Click Command6_Click Command5_Click Command0_Click Write a series of records to a disk file. We'll read this file into memory later. Sample.dat FillListBox --- get the array memory object selector this only needs to be done once in any form or routine. Note that memory is NOT locked. It doesn't need to be in in protected mode so the selector is valid even if the memory object gets moved. As this routine requires the Win 3.1 API calls, the app will always be running in protected mode. --- read records from array (f_NbrRecs is total # of records)= --- read a record from array into f_Rec record structure --- add record to listbox Command3_Click Write records to memory in reverse order Command4_Click